
using Xeralabs.Core.Utils.Internals;
using System;

namespace Xeralabs.Core.Internals
{
    internal delegate void KernelTaskDelegate(int id, double time, object arg);

    internal class KernelTask : iTask
    {
        private event KernelTaskDelegate _taskEvt;
        internal virtual KernelTaskDelegate TaskEvent { get { return _taskEvt; } set { _taskEvt = value; } }

        #region Miembros de iTask
        public double Budget
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }

        public void Execute(int id, double time, object arg)
        {
            if (_taskEvt != null)
                _taskEvt(id, time, arg);
        }
        #endregion
    }

    internal interface iResultTask<T> : iTask
    {
        void ResultOut(int id, double time, object arg, out T result);
    }
}
